package com.unitd.base.frame.plugin.db.datasource.sqls;

/**
 * 异构sql获取
 *
 * @author Hudan
 * @version 1.0
 * @filename AbstractSql.java
 * @copyright www.unitd.com
 * @date 2020-06-28
 */
public abstract class AbstractSql {

    /**
     * 获取异构sql
     *
     * @param jdbcUrl 数据源连接的JDBC URL
     * @return 异构sql
     */
    public String getSql(String jdbcUrl) {
        if (jdbcUrl.contains("oracle")) {
            return oracle();
        } else if (jdbcUrl.contains("postgresql")) {
            return pgSql();
        } else if (jdbcUrl.contains("sqlserver")) {
            return sqlServer();
        } else {
            return mysql();
        }
    }

    protected abstract String mysql();

    protected abstract String sqlServer();

    protected abstract String pgSql();

    protected abstract String oracle();
}